package com.meida.module.bus.provider.controller;

import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import com.meida.common.mybatis.model.*;

import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.bind.annotation.RestController;
import com.meida.common.springmvc.base.BaseController;
import com.meida.module.bus.client.entity.BusRecDeliveryBkView;
import com.meida.module.bus.provider.service.BusRecDeliBkViewService;


/**
 * VIEW控制器
 *
 * @author flyme
 * @date 2020-12-14
 */
@RestController
@RequestMapping("/bus/recDeliReqView/")
public class BusRecDeliBkViewController extends BaseController<BusRecDeliBkViewService, BusRecDeliveryBkView>  {

    @ApiOperation(value = "VIEW-分页列表", notes = "VIEW分页列表")
    @GetMapping(value = "page")
    public ResultBody pageList(@RequestParam(required = false) Map params) {
        return bizService.pageList(params);
    }

    @ApiOperation(value = "VIEW-列表", notes = "VIEW列表")
    @GetMapping(value = "list")
    public ResultBody list(@RequestParam(required = false) Map params) {
        return bizService.listEntityMap(params);
    }

    @ApiOperation(value = "VIEW-添加", notes = "添加VIEW")
    @PostMapping(value = "save")
    public ResultBody save(@RequestBody List<BusRecDeliveryBkView> busRecDeliveryBkViews) {
        bizService.recDeliveryMkBk(busRecDeliveryBkViews);
        return ResultBody.ok("提交成功");
    }

    @ApiOperation(value = "VIEW-更新", notes = "更新VIEW")
    @PostMapping(value = "update")
    public ResultBody update(@RequestParam(required = false) Map params) {
        return bizService.edit(params);
    }

    @ApiOperation(value = "VIEW-删除", notes = "删除VIEW")
    @PostMapping(value = "remove")
    public ResultBody remove(@RequestParam(required = false) Map params) {
        return bizService.delete(params);
    }


    @ApiOperation(value = "VIEW-详情", notes = "VIEW详情")
    @GetMapping(value = "get")
    public ResultBody get(@RequestParam(required = false) Map params) {
        return bizService.get(params);
    }
    /**
    * 导出VIEW统计
    *
    * @param params
    * @param request
    * @param response
    */
    @PostMapping(value = "export")
    public void export(@RequestParam(required = false) Map params, HttpServletRequest request, HttpServletResponse response) {
        bizService.export(params, request, response, "VIEW统计", "VIEW统计表");
    }

}
